package com.xrui.hbase.exception;


import com.xrui.hbase.HBaseURI;

import java.io.IOException;

/**
 * Thrown when an attempt to access a table fails because it does not exist.
 */
public final class TableNotFoundException extends IOException {
  /** URI of the missing table. */
  private final HBaseURI mTableURI;

  /**
   * Creates a new <code>TableNotFoundException</code> for the specified table.
   *
   * @param tableURI URI of the table that wasn't found.
   */
  public TableNotFoundException(HBaseURI tableURI) {
    super("DatabaseTable not found: " + tableURI);
    mTableURI = tableURI;
  }

  /**
   * Returns the name of the missing table.
   * @return the name of the missing table.
   */
  public String getTableName() {
    return mTableURI.getTable();
  }

  /**
   * Returns the URI of the missing table.
   * @return the URI of the missing table.
   */
  public HBaseURI getTableURI() {
    return mTableURI;
  }
}
